package com.mef.smsplat.util;

import java.io.StringWriter;
import java.util.HashMap;
import java.util.Map;

import freemarker.template.Configuration;
import freemarker.template.Template;

public class Test{
	
	public static void main(String[] args) throws Exception {
		Configuration cfg = new Configuration();    
		StringTemplateLoader stl = new StringTemplateLoader("hello：${user}");
		stl.addTemplate("110", "你好:${user}");
		stl.addTemplate("110", "你好a:${user}");
        cfg.setTemplateLoader(stl);    
        cfg.setDefaultEncoding("UTF-8");    
   
        Template template = cfg.getTemplate("110");    
            
        Map root = new HashMap();    
        root.put("user", "lunzi");    
            
        StringWriter writer = new StringWriter();    
        template.process(root, writer);    
        System.out.println(writer.toString());          
	}
}